package cn.zn.framework.printer.enums;

import lombok.Getter;

/**
 * 芯烨云返回码
 *
 * @author zn
 */

@Getter
public enum XYReturnCodeEnum {
    CODE_0("0", "成功"),
    CODE_1009("1009", "用户添加打印机时，打印机编号或名称不能为空"),
    CODE_1011("1011", "打印机已存在"),
    CODE_1010("1010", "打印机设备编号无效"),
    CODE_1012("1012", "添加打印设备失败，请稍后再试"),
    ;
    private String code;
    private String msg;

    XYReturnCodeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static XYReturnCodeEnum findByCode(String code) {
        for (XYReturnCodeEnum e : values()) {
            if (e.getCode().equalsIgnoreCase(code)) {
                return e;
            }
        }
        return null;
    }
}
